const sidKey="hccm_user_sid";
const userCodeKey="hccm_user_code";
const userKey="hccm_user";
const userIdKey="hccm_user_id";
const userCcIdKey="hccm_user_cc_id";
const wxOpenIdKey="hccm_wx_openid";
const avator="avator";
const wxSocialIdKey="hccm_wx_socialid";
const offsetTop="hccm_woffset_top";
const offsetHeight = 'hccm_woffset_height';
const injectionInfo = 'hccm_injection_info';
const chooseContent="hccm_choose_content";
const areaList = 'area_list'
const userPhone = 'user_phone'
const userHospId = 'user_hosp_id'
const phoneToken = 'phone_token'
const role = 'role'


//当前SessionId
const getSessionId=function(){
	var value=uni.getStorageSync(sidKey);
	return value;
}

//当前SessionId
const setSessionId=function(value){
	uni.setStorageSync(sidKey,value);
}

//当前账号的code
const getUserCode = function() {
	var value = uni.getStorageSync(userCodeKey);
	return value ? value : "";
}

//当前账号code
const setUserCode = function(value) {
	uni.setStorageSync(userCodeKey, value);
}

//当前用户实体
const getUser = function() {
	var value = uni.getStorageSync(userKey);
	return value ? value : "";
}

//当前用户实体
const setUser = function(value) {
	uni.setStorageSync(userKey, value);
}

//当前用户权限
const getRole = function() {
	var value = uni.getStorageSync(role);
	return value ? value : "";
}

//当前用户实体
const setRole = function(value) {
	uni.setStorageSync(role, value);
}

// 设置省市区列表
const setAreaList = function (value) {
  uni.setStorageSync(areaList, value)
}

// 获取省市区列表
const getAreaList = function (value) {
  var value = uni.getStorageSync(areaList)
  return value ? value : ''
}

//当前用户Id
const getUserId = function() {
	var value = uni.getStorageSync(userIdKey);
	return value ? value : "";
}

//当前用户Id
const setUserId = function(value) {
	uni.setStorageSync(userIdKey, value);
}

//当前用户 手机号
const setUserPhone = function (value) {
  uni.setStorageSync(userPhone, value)
}

//当前用户 手机号
const getUserPhone = function() {
	var value = uni.getStorageSync(userPhone)
	return value ? value : "";
}

//当前用户 医院id
const setUserHospId = function (value) {
  uni.setStorageSync(userHospId, value)
}

//当前用户 医院id
const getUserHospId = function () {
  var value = uni.getStorageSync(userHospId)
  return value ? value : ''
}

//当前用户ccUserId
const getCcUserId = function() {
	var value = uni.getStorageSync(userCcIdKey);
	return value ? value : "";
}

//当前用户ccUserId
const setCcUserId = function(value) {
	uni.setStorageSync(userCcIdKey, value);
}

//微信的openid
const getWxOpenId = function() {
	var value = uni.getStorageSync(wxOpenIdKey);
	return value;
}

//微信的openid
const setWxOpenId = function(value) {
	uni.setStorageSync(wxOpenIdKey, value);
}

//手机号token
const getPhoneToken = function() {
	var value = uni.getStorageSync(phoneToken);
	return value;
}

//手机号token
const setPhoneToken = function (value) {
  uni.setStorageSync(phoneToken, value)
}

//微信头像
const getAvator = function() {
	var value = uni.getStorageSync(avator);
	return value;
}

//微信头像
const setAvator = function(value) {
	uni.setStorageSync(avator, value);
}

//用于微信绑定的
const getSocialId = function() {
	var value = uni.getStorageSync(wxSocialIdKey);
	return value;
}

//设置安全高度
const setOffsetTop = function(value) {
	uni.setStorageSync(offsetTop, value);
}

//获取安全高度
const getOffsetTop = function() {
	var value = uni.getStorageSync(offsetTop);
	return value;
}

//设置可视高度
const setOffsetHeight = function(value) {
	uni.setStorageSync(offsetHeight, value);
}

//获取可视高度
const getOffsetHeight = function() {
	var value = uni.getStorageSync(offsetHeight)
	return value;
}

//设置针剂处方详情
const setInjectionInfo = function(value) {
	uni.setStorageSync(injectionInfo, value);
}

//获取针剂处方详情
const getInjectionInfo = function() {
	var value = uni.getStorageSync(injectionInfo)
	return value;
}

//设置感兴趣的内容，如果没有登录或者登录了没有选择的情况下
const setChooseContent = function(value) {
	uni.setStorageSync(chooseContent, value);
}

//获取感兴趣的内容，如果没有登录或者登录了没有选择的情况下
const getChooseContent = function() {
	var value = uni.getStorageSync(chooseContent);
	return value;
}

//微信的用于微信绑定的
const setSocialId = function(value) {
	uni.setStorageSync(wxSocialIdKey, value);
}

const clearUserMessage = function() {
	uni.setStorageSync(sidKey, "");
	uni.setStorageSync(userCodeKey, "");
	uni.setStorageSync(userKey, "");
	uni.setStorageSync(userIdKey, "");
}

module.exports = {
  clearUserMessage,
  setSessionId, //登录的sid
  getSessionId,
  getUserCode, //登录账号的code
  setUserCode,
  setUser, //登录获取的用户info
  getUser,
	setRole,
	getRole,
  setAreaList, //获取地区列表
  getAreaList,
  getUserId, //用户id
  setUserId,
  getUserPhone, //用户手机号
  setUserPhone,
  setUserHospId, //用户医院id
  getUserHospId,
  getCcUserId, // 用户ccUserId
  setCcUserId,
  getWxOpenId, //微信openid
  getAvator, //微信头像
  setAvator, //微信头像
  getPhoneToken,
  setPhoneToken,
  getSocialId,
  setWxOpenId,
  setSocialId,
  setSocialId,
  setOffsetTop,
  getOffsetTop,
  setOffsetHeight,
  getOffsetHeight,
  setChooseContent,
  getChooseContent,
  setInjectionInfo,
  getInjectionInfo
}
